<?php
namespace Plugin\Attractions\Inspection\Schema\Inspection_plans;

use Plugin\Attractions\Inspection\Model\Inspection_plans\InspectionPlans;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 日常巡检计划
 */
#[Schema(title: 'InspectionPlansSchema')]
class InspectionPlansSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: 'ID', type: 'bigint')]
    public string $id;

    #[Property(property: 'name', title: '计划名称', type: 'string')]
    public string $name;

    #[Property(property: 'cycle', title: '巡检周期 1每日、2每周、3每月', type: 'tinyint')]
    public string $cycle;

    #[Property(property: 'person', title: '巡检人', type: 'array')]
    public array $person;

    #[Property(property: 'devices', title: '巡检设备', type: 'array')]
    public array $devices;

    #[Property(property: 'created_at', title: 'created_at', type: 'timestamp')]
    public string $created_at;

    #[Property(property: 'updated_at', title: 'updated_at', type: 'timestamp')]
    public string $updated_at;




    public function __construct(InspectionPlans $model)
    {
       $this->id = $model->id;
       $this->name = $model->name;
       $this->cycle = $model->cycle;
       $this->person = $model->person;
       $this->devices = $model->devices;
       $this->created_at = $model->created_at;
       $this->updated_at = $model->updated_at;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'name' => $this->name ,'cycle' => $this->cycle ,'person' => $this->person ,'devices' => $this->devices ,'created_at' => $this->created_at ,'updated_at' => $this->updated_at];
    }
}